package com.bit.util;

import com.bit.Model.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class UserBean {
    //bean对象可以重命名
    @Scope("prototype")
    //@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @Bean(name = {"u1"})
    public User user1() {
        User user = new User();
        user.setId(1);
        user.setName("Java");
        return user;
    }
    @Bean(name = {"u2"})
    public User user2() {
        User user = new User();
        user.setId(1);
        user.setName("Java");
        return user;
    }
}
